<!doctype html>
<html>

<head>
    <title>Line Chart</title>
    <script src="/Public/js/chart/dist/Chart.bundle.js"></script>
    <script src="/Public/js/chart/samples/utils.js"></script>
    <style>
    canvas{
        -moz-user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
    }
    </style>
</head>

<body>
    <div style="width:75%;">
        <form class="inline" action="<?php echo '/User/Meeting/statistics';?>">
            <input type="hidden" name="meetId" value="<?php echo I('get.meetId', '', '');?>">
            <div class="form-group">
                <label class="col-sm-1 control-label">开始时间:</label>

                <div class="col-lg-3">
                    <input class="form-control" id="date-picker1" name="start_date" value="<?php
                    echo I('get.start_date', '', '');?>" placeholder="请输入开始时间">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label">结束时间:</label>

                <div class="col-lg-3">
                    <input class="form-control" id="date-picker2" name="end_date" value="<?php
                    echo I('get.end_date', '', '');?>" placeholder="请输入结束时间">
                </div>
            </div>
            <div>
                <button class="btn btn-success" type="submit">查询</button>
            </div>
        </form>
        <canvas id="canvas"></canvas>
        <div id="canvas-holder" style="width: 60%;float: left">
            <canvas id="chart-area" />
        </div>
        <table style="width: 30%;font-size:larger;" class="table table-bordered">
            <tr>
                <td>报名总量</td>
                <td>今日新增报名数</td>
            </tr>
            <tr>
                <td>{$total}</td>
                <td>{$today}</td>
            </tr>
        </table>
    </div>
    <br>
    <br>
    <script>
        var dates = {$dates};
        var pv = {$pv};
        var uv = {$uv};
        var config = {
            type: 'line',
            data: {
                labels: dates,
                datasets: [{
                    label: "pv",
                    backgroundColor: window.chartColors.red,
                    borderColor: window.chartColors.red,
                    data: pv,
                    fill: false,
                }, {
                    label: "uv",
                    fill: false,
                    backgroundColor: window.chartColors.blue,
                    borderColor: window.chartColors.blue,
                    data: uv,
                }]
            },
            options: {
                responsive: true,
                title:{
                    display:true,
                    text:'浏览情况'
                },
                tooltips: {
                    mode: 'index',
                    intersect: false,
                },
                hover: {
                    mode: 'nearest',
                    intersect: true
                },
                scales: {
                    xAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: '日期'
                        }
                    }],
                    yAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: '数量'
                        }
                    }]
                }
            }
        };
        var randomScalingFactor = function() {
            return Math.round(Math.random() * 100);
        };
        var data = {$sign};
        var config_circle = {
            type: 'doughnut',
            data: {
                datasets: [{
                    data: data,
                    backgroundColor: [
                        window.chartColors.red,
                        window.chartColors.orange,
                    ],
                    label: 'Dataset 1'
                }],
                labels: [
                    "未签到人数",
                    "签到人数",
                ]
            },
            options: {
                responsive: true,
                legend: {
                    position: 'top',
                },
                title: {
                    display: true,
                    text: '报名统计'
                },
                animation: {
                    animateScale: true,
                    animateRotate: true
                }
            }
        };

        window.onload = function() {
            var ctx = document.getElementById("canvas").getContext("2d");
            window.myLine = new Chart(ctx, config);

            ctx = document.getElementById("chart-area").getContext("2d");
            window.myDoughnut = new Chart(ctx, config_circle);
        };

    </script>
    <script type="text/javascript" src="/Public/js/laydatenew/laydate.js"></script>
    <script type="text/javascript">
        laydate.render({
            elem: '#date-picker1',
            type: 'date'
        });
        laydate.render({
            elem: '#date-picker2',
            type: 'date'
        });
    </script>
</body>

</html>
